package com.crm.system.controller.userForumManager;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.entity.userForumManager.UserForumLike;
import com.crm.system.service.userForumManager.UserForumLikeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:chaifuyou
 * @Date: 2021/5/24 9:34
 */
@RestController
@RequestMapping("/userForumLike")
@Slf4j
public class UserForumLikeController {

    @Autowired
    private UserForumLikeService userForumLikeService;

    /**
     * 添加 点赞 收藏 转发
     * @param userForumLike
     * @return
     */
    @PostMapping("/addUserForumLike")
    public DataResponse addUserForumLike(@RequestBody UserForumLike userForumLike){
        userForumLikeService.addUserForumLike(userForumLike);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode());
    }

    /**
     * 取消 点赞 收藏 转发
     * @param userForumLike 前端传论坛id、类型
     * @return
     */
    @PostMapping("/delUserForumLike")
    public DataResponse delUserForumLike(@RequestBody UserForumLike userForumLike){
        userForumLikeService.delUserForumLike(userForumLike);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode());
    }
}
